import { AppThunk } from '../index'
import { http } from '@/utils/http'
import { DataType } from '@/pages/type'
import { changeToken } from '../modules/login'
// 3. 异步action
export const loginAction = (formData: DataType): AppThunk => {
  return async (dispatch, getState) => {
    const res = await http.post('/authorizations', formData)
    console.log(res)
    dispatch(changeToken(res.data.data.token))
  }
}